package com.fsl.springbootapollo.controller;

import com.fsl.springbootapollo.dto.ServiceResult;
import com.fsl.springbootapollo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ApolloController {

    @Value("${name:yudd}")
    private String name;

    @Value("${age:18}")
    private Integer age;

    @Value("${address:广州市花都区}")
    private String address;


    @GetMapping("/getInfo")
    public String getInfo(){
        return name + "----->" + age + "------>" + address;
    }


    @Autowired
    private StudentService studentService;

    @ResponseBody
    @RequestMapping("/listStudent")
    public ServiceResult listStudent(){
        return ServiceResult.success(studentService.selectByPrimaryKey(996018439061505L));
    }
}
